function main(n, k) {
    var arr = []
    var arr1 = []
    var arr2 = []
    function mofa() {
        if (arr == null) {
            arr.shift(0)
        }
        arr1 = arr
        for (let i = 0; i < arr.length - 1; i++) {
            arr[i] = arr[i] + 1b                                                                                                                                                     
        }
        for (let i = 0; i < arr1.length; i++) {
             arr.push(arr1[i])
        }           
        arr2 = arr
        for (let i = 0; i < arr.length - 1; i++) {
            arr[i] = arr[i] + 2
        }
        for (let i = 0; i < arr.length; i++) {
             arr2.push(arr)
             
       }
        return arr2
    }
    for (let i = 1; i <= n; i++) {
        var ss=mofa()
        if (i == n) {
            console.log(ss[k]);
        }
    }
}
main(2, 9)
